package com.slz3.business.module.drawManagement.draFreeLottery.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.enums.YNFlag;
import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.frame.module.DomainEntity;
import com.slz3.business.module.drawManagement.draFreeLottery.enums.DraFreeLotteryGoodsDrawPeopleFlag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.time.LocalDateTime;
import java.util.UUID;

import static javax.persistence.EnumType.STRING;

@MappedSuperclass
@Data
@EqualsAndHashCode(callSuper = false)
public class DraFreeLotteryEntity extends DomainEntity {

    /**
     * 编号
     */
    @Column(length = 80)
    @NotNull(message = "serNum 必须非空!", groups = {Add.class, Modify.class})
    @Length(min = 1, max = 80, message = "ser2 必须非空并且不超过 80 个字符!", groups = {Add.class, Modify.class})
    private String serNum;

    /**
     * 备注
     */
    @Basic(fetch = FetchType.LAZY)
    @Type(type = "text")
    private String serMemo;

    /**
     * 审核状态
     */
    @Enumerated(STRING)
    @NotNull(message = "serAudit 必须非空!", groups = {Add.class})
    @Null(message = "serAudit 必须为空!", groups = {Modify.class})
    private AuditFlag serAudit;

    /**
     * 启用状态
     */
    @Enumerated(STRING)
    @NotNull(message = "serUsing 必须非空!", groups = {Add.class})
    @Null(message = "serUsing 必须为空!", groups = {Modify.class})
    private UsingFlag serUsing;

    /**
     * 标签
     */
    private String serLabels;

    /**
     * 抽奖描述
     */
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition = "TEXT")
    private String serGoodsDrawDesc;


    /**
     * 品牌类型（外键）
     */
    @NotNull(message = "品牌类型必须非空!", groups = {Add.class, Modify.class})
    private UUID serGoodsDrawBrand;


    /**
     * 活动名称
     */
    private String serGoodsDrawName;


    /**
     * 抽奖视频链接
     */
    private String serGoodsDrawView;

    /**
     * 几人团
     */
    @Enumerated(STRING)
    @NotNull(message = "抽奖类型 必须非空!", groups = {Add.class, Modify.class})
    private DraFreeLotteryGoodsDrawPeopleFlag serGoodsDrawPeople;


    /**
     * 总价值
     */
    private String serGoodsDrawPrice;


    /**
     * 抽奖结束时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime serGoodsDrawEndDate;


    /**
     * 开奖时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime serGoodsDrawOpenDate;


    /**
     * 抽奖开始时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime serGoodsDrawStartDate;


    /**
     * 图片轮播
     */
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition = "TEXT")
    private String serGoodsDrawP1;

    /**
     * 宫格展示图/搜索展示
     */
    private String serGoodsDrawP2;

    /**
     * 长图
     */
    private String serGoodsDrawP3;

    /**
     * 瀑布流图
     */
    private String serGoodsDrawP4;

    /**
     * 商品名称
     */
    private String serGoodsDrawPname;

    /**
     * 是否推送
     */
    private Integer serGoodsDrawState;

    /**
     * 免费抽所需的劵数
     */
    private Integer serGoodsDrawRefurbish;

    /**
     * 中奖号码
     */
    private String serGoodsDrawNumber;

    /**
     * 宽
     */
    private String serDrawWidth;

    /**
     * 高
     */
    private String serDrawHeight;

    /**
     * 是否已经开奖
     */
    @Enumerated(STRING)
    private YNFlag serAlreadyLotteryEnum;



}
